#include <stdio.h>
#include <stdlib.h>

#define N_MAX 9

void
_swap_ints(int* a, int* b)
{
	int t = *a;
	*a = *b;
	*b = t;
}

void
_print_1d_array(const int* const a, const int size, FILE* fp)
/* Self-explanatory */
{
	register int i;

	for (i = 0 ; i < size ; ++i) {
		fprintf(fp, "%1d", a[i]);
	}
}


long long
fact(long long in)
{
	if (in <= 1)
		return 1LL;
	else
		return in * fact(in - 1);
}


long long
C_n_k(long long n, long long k)
{
	long long ret;
	ret = fact(n) / ( fact(k) * fact(n-k) ); /* lol */
	return ret;
}


/* Dear diary,
 * this funtion receives an array of 0's and 1's which represents
 * a permutation and makes a new one, which is guaranteed to be different
 * from all others.
 * E.g { 1, 1, 0, 0, 0 } becomes { 1, 0, 1, 0, 0 },
 *     { 0, 1, 0, 0, 1 } ------- { 0, 0, 1, 1, 0 },
 *     { 0, 0, 1, 0, 1 } ------- { 0, 0, 0, 1, 1 } (final permutation).
 */
/* 22:27:19         <PoppaVic> │ const-pointer to-int
 * 22:27:32         <wingless> │ flyz: Think simpler. There is no pass-by-reference in C. Function parameters are always copies.
 */
void
next_permutation(int* const act, const int n)
{
	int i=0, first0 = -1, last1 = 0, last10 = -1;

	fputs(" (", stderr);
	_print_1d_array(act, n, stderr);
	fputs(")", stderr);

	while (i<n) {
		if (act[i] == 1) {
			last1 = i;
			if (i < n - 1 && act[i+1] == 0)
				last10 = i;
		} else if (first0 == -1)
			first0 = i;
		++i;
	}

	if (first0 == 0 && act[0] == 0) {
		next_permutation(act + 1, n - 1);
		return;
	} else if (last1 == n - 1 && first0 == -1) {
		return; /* all 1's are in the end of array */
	} else if (last1 == n - 1) {
		i = n - 1; /* move bits */
		/* look for last { ... 1, 0, ... } pattern */
		if (last10 != -1)
		{ /* aww.. */
			_swap_ints(&act[last10], &act[last10 + 1]);
			last10 += 1;
			while (act[last10] != 0 && last10 < n)
				++last10;
			if (last10 == n - 1)
				return; /* no zeroes at the end. this shouldn't happen
					   as we've already handled this situation before */
			i = last10;
			while (++i < n) {
				if (act[i] == 1)
					_swap_ints(&act[last10++], &act[i]);
			}
		}
	} else if (last1 < n - 1) {
		_swap_ints(&act[last1], &act[last1 + 1]);
	}
}


long long
all_possible_permutations(int* const in_, const int n, const int suppr_count)
{
	long long result = 0, curr_iter = 1;
	int active[N_MAX];
	register int k = 0, l = suppr_count;

	while (k < n)
		active[k++] = (l-- > 0) ? 1 : 0; /* 0 - disregarding coeff. ; 1 - multiplying.
		                                  * active[] now looks somewhat like this: { 1, 1, 1, 0, 0, 0, 0, 0, 0 } */
	for (k = 0 ; k < C_n_k((long long) n, (long long) suppr_count) ; ++k) {
		for (l = 0; l < n; ++l) {
			curr_iter *= active[l] ? (-1 * in_[l]) : 1;
		}
		next_permutation(active, n);
			putc('\n', stderr);
		fprintf(stderr, "-- curr_iter=%lld\n", curr_iter);
		result += curr_iter;
		curr_iter = 1;
	}
	fprintf(stderr, "-- all_possible_permutations(int* const in_, const int n=%d, const int suppr_count=%d) --\n\n", n, suppr_count);
	return result;
}


int
main(void)
{
	int in_[N_MAX], n;
	int i = 0, j = 0;

	(void)freopen("brackets.in", "rt", stdin);
	freopen("brackets.out","w", stdout);

	(void)scanf("%d\n", &n);
	while (i<n)
		(void)scanf("%d", &in_[i++]);

	fputs("1 ", stdout);

	for (i = 0; i < n; ++i) {
		printf("%lld ", all_possible_permutations(in_, n, ++j));
	}
	putc('\n', stdout);
	return EXIT_SUCCESS;
}

/* end of story
 */
